﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BaseData.UI;

namespace Shizir.AjaxPage
{
    public partial class RegisterHelper : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string action = BasePage.GetRequest("action").ToLower();
            if (!string.IsNullOrEmpty(action))
            {
                switch (action)
                {
                    case "getcitys":
                        Response.Write(this.GetCitys());
                        break;
                    case "getcompanies":
                        Response.Write(this.GetCompanys());
                        break;
                    case "checkname":
                        Response.Write(this.CheckUserName());
                        break;
                    case "checkmobile":
                        Response.Write("false");
                        break;
                }
            }
        }

        private string GetCitys()
        {
            return "{r:'北京,唐山,深圳,广州,'}";
            //return "DoResultMethod('txtCity',{r:'北京,唐山,深圳,广州,'})";
        }

        private string GetCompanys()
        {
            return "document.getElementById('selCompany').length=0; DoResultMethod2('selCompany',{r:'链家地产,我爱我家,鑫尊地产,中原地产,21世纪,中汇易家,中大恒基,荧灿地产,中天置地,中宇慧通,麦田房产,万众恒基,中鼎联行,宏成行,房屋公园,易家地产,千顷家园,'}, {r:'http://img.soufun.com/secondhouse/image/magent/companylogo/bj/ljdc.jpg,http://img.soufun.com/secondhouse/image/magent/companylogo/bj/wawj.jpg,http://img.soufun.com/secondhouse/image/magent/companylogo/bj/xzdc.jpg,http://img.soufun.com/secondhouse/image/magent/companylogo/bj/zydc1.jpg,http://img.soufun.com/secondhouse/image/magent/companylogo/bj/21century.jpg,http://img.soufun.com/secondhouse/image/magent/companylogo/bj/zhyj.jpg,http://img.soufun.com/secondhouse/image/magent/companylogo/bj/zdhj.jpg,http://img.soufun.com/secondhouse/image/magent/companylogo/bj/ycdc.jpg,http://img.soufun.com/secondhouse/image/magent/companylogo/bj/ztzd.jpg,http://img.soufun.com/secondhouse/image/magent/companylogo/bj/zyht.jpg,http://img.soufun.com/secondhouse/image/magent/companylogo/bj/mtfc.jpg,http://img.soufun.com/secondhouse/image/magent/companylogo/bj/wzhj.jpg,http://img.soufun.com/secondhouse/image/magent/companylogo/bj/zdlh.jpg,http://img.soufun.com/secondhouse/image/magent/companylogo/bj/hch.jpg,http://img.soufun.com/secondhouse/image/magent/companylogo/bj/fwgy.jpg,http://img.soufun.com/secondhouse/image/magent/companylogo/bj/yjdc.jpg,http://img1n.soufun.com/agents/2010_09/19/bj/misc/1284862033307.jpg,'})";
        }

        private string CheckUserName()
        {
            string ret = "恭喜，用户名还没有被注册！";
            ShizirBLL.User.UserBaseBiz ubb = new ShizirBLL.User.UserBaseBiz();
            if (ubb.Exists(BasePage.GetRequest("username")))
            {
                ret = "该用户名已注册！";
            }
            return ret;
        }
    }
}